#include <stdio.h>
#include <iostream>
#include <stdint.h>
#include <string.h>
using namespace std;

uint32_t calc_checksum(char *buf, uint16_t len)
{
    uint32_t ret = 0;
    for (int i = 0; i < len; i++)
        ret += buf[i];
    return ret;
}

int main()
{
    char *str = R"({"payload":{"smartBuckles":[{"temperature":0,"heartbeat":0,"finger_f":false}],"bme280":{"temperature":30.75,"humidity":45.87598,"altitude":12.30082,"pressure":1011.773},"m702":{"CO2":418,"CH2O":1,"TVOC":10,"PM25":4,"PM10":4,"temperature":27.07,"humidity":77.01},"NH":0}})";
    uint32_t ret = calc_checksum(str, strlen(str));
    // cout << ret;
    printf("%d", ret);
    return 0;
}
